<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('应收表列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>部门：</p>
                                <input type="text" name="department"/>
                            </li>
                            <li>
                                <p>销售责任人一：</p>
                                <input type="text" name="salesmanFirst"/>
                            </li>
                            <li>
                                <p>销售责任人二：</p>
                                <input type="text" name="salesmanSecond"/>
                            </li>
                            <li>
                                <p>收款单位：</p>
                                <input type="text" name="collectionCompany"/>
                            </li>
                            <li>
                                <p>客户名称：</p>
                                <input type="text" name="customerName"/>
                            </li>
                            <li>
                                <p>合同编号：</p>
                                <input type="text" name="contractNo"/>
                            </li>
                            <li>
                                <p>合同名称：</p>
                                <input type="text" name="contractName"/>
                            </li>
                            <li>
                                <p>阶段名称：</p>
                                <input type="text" name="stageName"/>
                            </li>
                            <li>
                                <p>合同金额：</p>
                                <input type="text" name="contractMoney"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:yingshou:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:yingshou:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:yingshou:remove')}]];
        var prefix = ctx + "system/yingshou";
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "应收表",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : '主键id',
                    visible: false
                },
                {
                    field : 'department', 
                    title : '部门'
                },
                {
                    field : 'salesmanFirst', 
                    title : '销售责任人一'
                },
                {
                    field : 'salesmanSecond', 
                    title : '销售责任人二'
                },
                {
                    field : 'collectionCompany', 
                    title : '收款单位'
                },
                {
                    field : 'customerName', 
                    title : '客户名称'
                },
                {
                    field : 'contractNo', 
                    title : '合同编号'
                },
                {
                    field : 'contractName', 
                    title : '合同名称'
                },
                {
                    field : 'stageName', 
                    title : '阶段名称'
                },
                {
                    field : 'contractMoney', 
                    title : '合同金额'
                },

                {
                    title: '各月详情',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="link'
                            + editFlag
                            + '" href="javascript:void(0)" onclick="openChildTable(\'' + row.stageId + '\')"><i class="fa fa-edit"></i>显示月份详情</a> ');
                        return actions.join('');
                    }
                }]

            };
            $.table.init(options);
        });

        openChildTable = function(stageId) {
            $.modal.openOptions({
                title: '月份详情',
                width: "880",
                url: "./monthDetail/listMonth/" + stageId
            });
        }



    </script>
</body>
</html>